#ifndef __BSP_DISTANCE_H__
#define __BSP_DISTANCE_H__

#include "Arduino.h"
#include <HardwareSerial.h>
#include <stdint.h>
#include <math.h>

typedef enum e_distance
{
  f_distance = 0b0001,
  b_distance = 0b0010,
  l_distance = 0b0100,
  r_distance = 0b1000
} e_distance;

#define F_DISTANCE A2
#define B_DISTANCE A3
#define L_DISTANCE A4
#define R_DISTANCE A5

#define SAMPLING_NUM 20    //读取红外测距模块的次数 用来取平均
#define MEDIAN_AVERAGE_REMOVE_NUM 5
void distance_Init(void);
void printDistance(void);
void getDistance(int* pMem,uint8_t choice);
void choice_distance(uint8_t choice);
int calculateVal(int analogIO);
// int calculateVal_aver(int analogIO);
#endif
